package algorithms.que14;

import java.util.Arrays;

/**
 * @功能
 * @创建时间 2020/9/7
 */
public class GetMA {
    public static void main(String[] args) {

    }
    public double[] get(double[] a){
        double[] b = new double[a.length];
        double[] c = new double[2];
        int len=a.length;
        for (int i = 0; i < len; i++) {
            b[i]=a[i];
        }
        Arrays.sort(b);
        double cnt=0;
        Double max=Double.MAX_VALUE;
        Double tmp;
        for (int i = 0; i < len-1; i++) {
            tmp=Math.abs(b[i+1]-b[i++]);
            if (tmp<max&&tmp>cnt){
                c[0]=b[i];
                c[1]=b[i-1];
                }

        }
   return c;
    }
}
